import 'package:flutter/material.dart';
import 'package:flutter_axrjc/widget/custom_selection.dart';
import 'package:get/get.dart';

import 'logic.dart';

class CheckLogDetailPage extends StatelessWidget {
  const CheckLogDetailPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final state = Get.find<CheckLogDetailLogic>().state;

    return Scaffold(
      backgroundColor: const Color(0xffF3F6F9),
      appBar: AppBar(
        backgroundColor: Colors.white,
        foregroundColor: Colors.black,
        titleSpacing: -10,
        elevation: 0,
        centerTitle: true,
        title: const Text(
          "检测记录详情",
          style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
        ),
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Obx(() {
                return CustomSelection(
                  "灯具名称",
                  value: state.logDetailBean.value?.fixtureName ?? '未填写灯具名称',
                );
              }),
              Obx(() {
                return CustomSelection("灯具品牌",
                    value: state.logDetailBean.value?.fixtureBrand ?? "");
              }),
              Obx(() {
                return CustomSelection(
                  "检测设备",
                  value:
                      "${state.logDetailBean.value?.checkOs ?? ""} ${state.logDetailBean.value?.mobileBrand ?? ""}${state.logDetailBean.value?.mobileModel ?? ""}",
                );
              }),
              Obx(() {
                return CustomSelection(
                  "检测开始时间",
                  value: state.logDetailBean.value?.detectionStartTime ?? "",
                );
              }),
              Obx(() {
                return CustomSelection(
                  "检测结束时间",
                  value: state.logDetailBean.value?.detectionEndTime ?? "",
                );
              }),
              Obx(() {
                return CustomSelection(
                  "平均色温",
                  value: "${state.logDetailBean.value?.colorTemp ?? ''}",
                );
              }),
              Obx(() {
                return CustomSelection("亮度最小值",
                    value:
                        "${state.logDetailBean.value?.detectionMinValue ?? ""}");
              }),
              Obx(() {
                return CustomSelection(
                  "亮度最大值",
                  value:
                      "${state.logDetailBean.value?.detectionMaxValue ?? ""}",
                );
              }),
              Obx(() {
                return CustomSelection(
                  "亮度平均值",
                  value:
                      "${state.logDetailBean.value?.detectionAverageValue ?? ""}",
                );
              }),
              Obx(() {
                return CustomSelection(
                  "灯光类型",
                  value: state.typename.value,
                  hintText: '未填写类型',
                );
              }),
              Obx(() {
                return CustomSelection(
                  "灯具模型",
                  value: state.logDetailBean.value?.fixtureModel ?? "",
                );
              }),
            ],
          ),
        ),
      ),
    );
  }
}
